﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace XNAStuding
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    
    public class drawRot : Microsoft.Xna.Framework.DrawableGameComponent
    {
        public Rectangle posTex;
        public Rectangle posD;
        public float rot;
        public Vector2 v;
        /// <summary>
        /// this class used to draw the textures(tools)that have different rotation angles
        /// </summary>
        /// <param name="game">object from class Game</param>
        /// <param name="posTex">the position of the distination rectangle in which the texture will be drew</param>
        /// <param name="posD">the position of the source rectangle from which the texture will be drew</param>
        /// <param name="rot">angle of the rotation of the texture(tool)</param>
        /// <param name="vert">the origin of the texture(tool)</param>
        public drawRot(Game game, Rectangle posTex, Rectangle posD,float rot,Vector2 vert): base(game)
        {
            this.v = vert;
            this.posTex = posTex;
            this.posD = posD;
            this.rot = rot;
        }
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
        }
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            Globals.spritePatch.Begin();
            Globals.spritePatch.Draw(Globals.Background, posD, posTex, Color.White, rot, v, SpriteEffects.None, 0f);
            Globals.spritePatch.End();
            base.Draw(gameTime);
        }
    }
}